<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c-rt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ page import="com.yaodian100.core.common.utils.ServerValue"%>
<c-rt:set var="now" value="<%=new java.util.Date()%>" />
<c-rt:set var="frontContextPath" value='<%=ServerValue.getFrontContextPath()%>'/>
<c-rt:set var="trustMembers" value='<%=ServerValue.getTrustMemberString() %>'/>
<html>
<head>
<script src="/js/dateSelecter.js"></script>
<script language="javascript">
	$().ready(function(){

		$("#current_location").html('&nbsp;&gt;&nbsp;个人信息管理&nbsp;-&nbsp;修改个人信息');
		$("#m_modifyData").css("font-weight","bold");

		if ( parseInt("${member.mobileModifyCount}") >= 10 ){
			$("#dialog_over").dialog({
				autoOpen: false,
				bgiframe: true,
				height: 165,
				width:350,
				modal: true
			});
		}

		<c:if test="${empty member.email || member.email eq 'xx'}">
		$("#gocechkemail").click(function(){
			$("#resendForm").submit();
			return false;
		});
		</c:if>
		
		<c:if test="${canModifyDate > now}">
			$("#dialog_m5").dialog({
				autoOpen: false,
				bgiframe: true,
				height: 150,
				width:380,
				modal: true
			});
		</c:if>

		$("#new_mobile").click(function(){
			if ( parseInt("${member.mobileModifyCount}") >= 10 ){
				$("#dialog_over").dialog('open');
			}else{
				//new
				window.location.replace("${frontContextPath}/member/modifymobile.do");
				return false;
			}
		});

		$("#modify_mobile").click(function(){
			<c:choose>
			<c:when test="${canModifyDate > now}">
				$("#dialog_m5").dialog('open');
			</c:when>
			<c:otherwise>
				if ( parseInt("${member.mobileModifyCount}") >= 10 ){
					$("#dialog_over").dialog('open');
				}else{
					//modify
					window.location.replace("${frontContextPath}/member/modifymobile.do");
					return false;
				}
			</c:otherwise>
			</c:choose>
		});

		$(":a[id*=close_]").click(function(){
			var text = $(this).attr('id').split('_')[1];
			$("#dialog_"+text).dialog('close');
		});

		//1911為開始年份
		set_ddl_date(1930);
		$('#ddl_year').change();

		$("#subminInfo").click(function(){
			$("#sexTip").hide();
			if($('input[id=rsex]:checked').val()==undefined){
				$("#sexTip").show();
				$('input[id=rsex]').eq(0).focus();
				return false;
			}
			$("#ssex").val($('input[id=rsex]:checked').val());
			$("#sbirthday").val($("#ddl_year").val()+$("#ddl_month").val()+$("#ddl_day").val());
			$("#infoForm").submit();
			return false;
		});
	});	
</script>
</head>
<body>
<h2>修改个人信息<span class="txt-gy txt-s txt-normal">(首次完善个人信息并完成手机、邮箱的验证，将获得 ${completeInfoBonus} 积分，可作为现金抵用订单金额。标注<dfn class="txt-rd txt-bold">*</dfn>为必填栏位)</span></h2>
    <!-- 內容 -->
    <div class="change-email">
          <p class="c-f LH-1of5">&nbsp;</p>
          <div class="d-show">
            <ul>
              <li class="w-1of1"><div><strong style="padding-left:1em;">帐户名：</strong></div><div>${member.loginId}</div></li>
              <li class="w-1of1"><div><strong><span class="txt-rd">*&nbsp;</span>登录邮箱：</strong></div>
              	<div>
              	<c:choose>
					<c:when test="${empty member.email || member.email eq 'xx'}">
						<c:if test="${!empty member.tempEmail}">
						${member.tempEmail}<a href="${frontContextPath}/member/modifyemail.do">&nbsp;修改邮箱</a>&nbsp; <a href="javascript:;" id="gocechkemail">验证邮箱</a>
						<s:form action="resendModifyEmail.do" method="post" id="resendForm">
						<input type="hidden" name="loginID" value="${member.loginId}">
						</s:form>
						</c:if>
						<c:if test="${empty member.tempEmail}">
						<a href="${frontContextPath}/member/modifyemail.do">&nbsp;新增邮箱</a>
						</c:if>
					</c:when>
					<c:otherwise>
						${member.email}<a href="${frontContextPath}/member/modifyemail.do">&nbsp;修改邮箱</a> <span class="data-checked">(<b>&nbsp;</b>已验证)</span>
					</c:otherwise>
				</c:choose>
              	</div>
              </li>
              <li class="w-1of1"><div><strong><span class="txt-rd">*&nbsp;</span>手机号码：</strong></div>
              	<div>
              	<c:choose>
					<c:when test="${empty member.mobile}">
						<a href="javascript:;" id="new_mobile">新增手机</a>
					</c:when>
					<c:otherwise>
						${member.mobile}&nbsp; <a href="javascript:;" id="modify_mobile">修改号码</a> <span class="data-checked">(<b>&nbsp;</b>已验证)</span>
					</c:otherwise>
				</c:choose>
              	</div>
              </li>
            </ul>
      </div>
      	<!-- START 完善个人信息区块 -->
        <div class="d-show data-complete">
          <p><Strong>补充信息</Strong> <span class="txt-gy">(请填写真实的个人信息)</span></p>
          <ul>
            <li class="w-1of1">
              <div><strong><span class="txt-rd">*&nbsp;</span>性别：</strong></div>
              <div>
              <c:choose>
				<c:when test="${empty member.crmUpdate || member.crmUpdate == '1'}">
				  <input type="radio" name="radio" id="rsex" value="M"/> 男
                  <input type="radio" name="radio" id="rsex" value="F"/> 女
                  <span class="txt-gy">(提交后将不可更改)</span><span style="display:block"><span class="msg rn" style="display:none;" id="sexTip">请选择性别</span></span>	
				</c:when>
				<c:otherwise>
				  <c:if test="${member.sex == 'M'}">男</c:if><c:if test="${member.sex != 'M'}">女</c:if> <span class="data-checked">(<b>&nbsp;</b>已提交，不可更改)</span>	
				</c:otherwise>
			  </c:choose>
              </div>
            </li>
            <li class="w-1of1">
              <div><strong><span class="txt-rd">*&nbsp;</span>生日：</strong></div>
              <div>
              <c:choose>
				<c:when test="${empty member.crmUpdate || member.crmUpdate == '1'}">
				  <select id="ddl_year" style="*width:5em;"></select>年
				  <select id="ddl_month" style="*width:3.6em;"></select>月
				  <select id="ddl_day" style="*width:3.6em;"></select>日
          		  <span class="txt-gy">(提交后将不可更改)</span><span style="display:block"><span class="msg rn" style="display:none" id="birthTip">请完整选择生日</span></span>	
				</c:when>
				<c:otherwise>
				  <fmt:formatDate pattern="yyyy年MM月dd日" value="${member.birthday}" /> <span class="data-checked">(<b>&nbsp;</b>已提交，不可更改)</span>	
				</c:otherwise>
			  </c:choose>
              </div>
            </li>
          </ul>
        </div>
        <c:if test="${empty member.crmUpdate || member.crmUpdate == '1'}">
        <p style="text-align:center"><a href="javascript:;" class="btn-mid-8" id="subminInfo">提交补充信息</a></p>
        <s:form action="updateSexAndBirthday.do" method="post" id="infoForm">
        <input type="hidden" name="sex" id="ssex"/>
        <input type="hidden" name="birthday" id="sbirthday"/>   
        </s:form>
        </c:if>
        <!-- END 完善个人信息区块 -->
    </div>
    <!-- 內容 -->
<!-- 讯息 -->
<c:if test="${member.mobileModifyCount>=10}">
<div id="dialog_over" title="验证手机" class="member-reg-alert" style="display:none;">
  <p>抱歉，每个帐户进行手机验证，一个月使用短信最多10次，您已达使用上限。</p>
  <div align="center"> <span style="text-align:center;"><a href="javascript:;" class="btn-mid" id="close_over">关闭</a></span> </div>
</div>
</c:if>
<c:if test="${canModifyDate > now}">
<DIV id="dialog_m5" title="修改手机号码" class="member-reg-alert" style="display:none;">
  <p>抱歉，您只能在5天内修改一次手机号码，<Br />请您在<strong class="txt-rd"><fmt:formatDate pattern="yyyy-MM-dd" value="${canModifyDate}" /></strong>後再次進行修改。</p>
  <div align="center"> <span style="text-align:center;"><a href="javascript:;" class="btn-mid" id="close_m5">关闭</a></span> </div>
</DIV>
</c:if>
<c:if test="${member.getBonus > 0}">
<script language="javascript">
	$().ready(function(){
		$("#msg_dialog").dialog({
			bgiframe : true,
			width : 480,
			height : 'auto',
			resizable : false,
			modal : true
		});
		$("#msg_dialog_close").click(function(){
			$("#msg_dialog").dialog('close');
		});
	});
</script>
<!-- START 完善个人信息成功弹窗 -->
<div id="msg_dialog" title="温馨提示" class="member-reg-alert-ok poise" style="display:none">
  <div>
  	<h3>您完善并验证个人信息成功，获得 <strong class="txt-rd">${member.getBonus}</strong> 积分！</h3>
    <dfn>获得的积分将可以作为现金抵用订单金额！</dfn>
  </div>
  <span class="btn-cradle"><a href="javascript:;" class="btn-mid" id="msg_dialog_close">确定</a></span>
</div>
<!-- START 完善个人信息成功弹窗 -->
</c:if>
</body>
</html>